package com.itheima.mall.web.cms;

import com.itheima.mall.commons.result.Result;
import com.itheima.mall.dubbo.api.cms.CmsSubjectService;
import com.itheima.mall.entity.domain.cms.Subject;
import com.itheima.mall.entity.page.MyPage;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("subject")
public class CmsSubjectController {
    @DubboReference
    private CmsSubjectService cmsSubjectService;
    @GetMapping("list")
    public Result list(String keyword,Integer pageNum,Integer pageSize){
       MyPage<Subject> page =  cmsSubjectService.getPage(keyword,pageNum,pageSize);
       return Result.success(page);
    }
    @GetMapping("listAll")
    public Result listAll(){
        List<Subject> list = cmsSubjectService.list();
        return Result.success(list);
    }
}
